import tkinter as tk
win = tk.Tk()
win.title("My First GUI")
win.geometry("400x300")
frame1=tk.Frame(win)
frame1.pack()
frame_left=tk.Frame(frame1)
tk.Label(frame_left,text="左侧标签1",bg="red",fg="white",width=10,height=5).grid(row=0,column=0)
tk.Label(frame_left,text="左侧标签2",bg="yellow",fg="black",width=10,height=5).grid(row=1,column=1)
frame_left.pack(side="left")
frame_right=tk.Frame(frame1)
tk.Label(frame_right,text="右侧标签1",bg="red",fg="white",width=10,height=5).grid(row=0,column=1)
tk.Label(frame_right,text="右侧标签2",bg="yellow",fg="black",width=10,height=5).grid(row=1,column=0)
tk.Label(frame_right,text="右侧标签3",bg="green",fg="white",width=10,height=5).grid(row=1,column=1)
frame_right.pack(side="right")
win.mainloop()